package com.safetys.co.gateway.v2.entity;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

/**
 * @author deqing.chedq
 * @Date 2025/07/01 12:59
 * @Description
 */
@Slf4j
@Data
public class Gateway {

    private String id;
    private String name;
    private String desc;
    private String uri;

    private Upstream upstream = new Upstream();
    private JSONObject plugins = new JSONObject();

    @Override
    public String toString() {

        JSONObject obj = JSONUtil.parseObj(this);
        JSONObject nodesObj = JSONUtil.parseObj(this.getUpstream(), false);
        obj.putOpt("upstream", nodesObj);
        return obj.toString();
    }
}
